#include	"proto.h"
#include    <stdio.h>
#include    <stdlib.h>
#include    <string.h>
#include    <errno.h>
#include    <fcntl.h>
#include    <sys/types.h>
#include    <sys/socket.h>
#include    <arpa/inet.h>
#include    <netdb.h>
#include    <netinet/in.h>
#include	<unistd.h>
#include    <signal.h>
#include    <pthread.h>

#define CLEN_PORT 8888

extern char flag; 
extern int sockfd;
extern int listenfd;
extern struct sockaddr_in sockAddr, listenAddr;
extern char buf[BUF_SIZE];
extern char myUID[LEN];
extern struct msgHead HeadMsg;

extern void WriteMsg(int fd, msgHead *HeadMsg, char *buf);
extern void ReadMsg(int fd, msgHead *HeadMsg, char *buf);
extern int init(int port, char *IP, SAI *addr);
extern void *p2pFunc(void *arg);
extern void *Listen(void *arg);
extern void err_sys(const char *s);
